package com.mhc.suzuki.manager.impl;

import com.mhc.suzuki.dal.mapper.ext.LoanInfoExtMapper;
import com.mhc.suzuki.dal.model.LoanInfoDO;
import com.mhc.suzuki.dal.query.LoanInfoQuery;
import com.mhc.suzuki.manager.LoanInfoManager;
import com.subaru.common.query.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for LoanInfo.
 */

@Component
public class LoanInfoManagerImpl implements LoanInfoManager {


    @Autowired
    protected LoanInfoExtMapper loanInfoExtMapper;

    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(LoanInfoQuery query) {
        return loanInfoExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(LoanInfoQuery query) {
        return loanInfoExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(LoanInfoDO record) {
        return loanInfoExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(LoanInfoDO record) {
        return loanInfoExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<LoanInfoDO> selectByQuery(LoanInfoQuery query) {
        return loanInfoExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
     */
    @Override
    public PageResult<LoanInfoDO> selectByQueryWithPage(LoanInfoQuery query) {
        PageResult<LoanInfoDO> result = new PageResult<LoanInfoDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public LoanInfoDO selectByPrimaryKey(Long id) {
        return loanInfoExtMapper.selectByPrimaryKey(id);
    }

    /**
     * select by order no.
     */
    @Override
    public LoanInfoDO selectByOrderNo(String orderNo) {
        return loanInfoExtMapper.selectByOrderNo(orderNo);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective(LoanInfoDO record, LoanInfoQuery query) {
        return loanInfoExtMapper.updateByQuerySelective(record, query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery(LoanInfoDO record, LoanInfoQuery query) {

        return loanInfoExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(LoanInfoDO record) {
        return loanInfoExtMapper.updateByPrimaryKeySelective(record);
    }
}
